package controller.GoodsTable;

import entity.MsgResult;
import entity.goods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.DeleteGoodsService;

@Controller
public class DeleteGoodsController {

    @Autowired
    private DeleteGoodsService deleteGoodsService;

    @RequestMapping("/deleteGoods")
    @ResponseBody
    public MsgResult deleteGoods(goods goods){
        MsgResult msgResult = new MsgResult();
        boolean b = deleteGoodsService.deleteGoods(goods.getGoodsId());
        if(b){
            msgResult.setFlag(1);
            msgResult.setMsg("删除商品成功");
            return msgResult;
        }
        msgResult.setFlag(0);
        msgResult.setMsg("删除商品失败");
        return msgResult;
    }
}
